/**
 * $Id: SpecialMobileSyncThread.java,v 1.5 2006/06/23 01:57:27 star Exp $
 *
 * Copyright 2006 Skyinfo, Inc. All Rights Reserved.
 */
package com.haoxi.gateway.runner.specialmobile;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * TODO
 * 
 * Revision History
 * 
 * 2006-5-30,star.Zhao,created it
 */
public class SpecialMobileSyncThread implements Runnable {
    private final static Log log = LogFactory
            .getLog(SpecialMobileSyncThread.class);
    private boolean running = true;
    private int delay;

    public SpecialMobileSyncThread(int delay) {
        this.delay = delay;
    }

    public void run() {
        log.debug("SpecialMobileChgThread Thread start()!");
        while (running) {
            // sleep
            try {
                Thread.sleep(delay);
            } catch (InterruptedException ite) {
                log.error("InterruptedException in SpecialMobileChgThread.run()!",ite);
            }
            
            // 同步
            if (!SpecialMobileMrg.init()) {
                log.error("SpecialMobileChgThread.run() syncronize the special mobile failure！");
            }else{
                log.debug("----shedule syncronize the special mobile info successfully！--------");
                log.debug ( "SenseMobileMap length is: [" + SpecialMobileMrg.senseMobileMap.size () + "]" );
                log.debug ( "BlackMobileMap length is: [" + SpecialMobileMrg.blackMobileMap.size () + "]" );
                log.debug ( "BlackLongNumMap length is: [" + SpecialMobileMrg.blackLongNumMap.size () + "]" );
            }

            
        }
    }

}
